"""
文件名:PortalOrderReturnApplyInterface.py
作用: 申请退货管理 模块的接口,每一个接口都有一个对应的方法,该方法用于测试用例
作者: 吴宇杰
"""

from Untils.SendMethod import SendMethod
from Interface.DHX_MemberInterface import MemberInterface


class PortalOrderReturnApplyInterface:
    def __init__(self):
        self.url = 'http://139.159.146.104:8083'

    def return_apply(self, returnApply: dict, username, password):
        """
        申请退货管理接口
        :return:
        """
        # 请求地址
        url = self.url + "/returnApply/create"
        member = MemberInterface()
        # 请求数据
        return SendMethod.send_method(method='post', url=url, json=returnApply,
                                      headers=member.get_token(username=username, password=password))


if __name__ == '__main__':
    pora = PortalOrderReturnApplyInterface()

    returnApply = {
      "description": "string",
      "memberUsername": "string",
      "orderId": 2,
      "orderSn": "string",
      "productAttr": "string",
      "productBrand": "string",
      "productCount": 0,
      "productId": 0,
      "productName": "string",
      "productPic": "string",
      "productPrice": 0,
      "productRealPrice": 0,
      "proofPics": "string",
      "reason": "string",
      "returnName": "string",
      "returnPhone": "string"
    }

    print(pora.return_apply(returnApply,username='liar',password='123456'))

